#include "stdafx.h"
#include "MediaData.h"

void MediaData::initAudioData(int dataType, int size, int timeSample){

	mDataType = dataType;
	mDataSize = size;
	mTimeSample = timeSample;
}

void MediaData::initVideoData(int dataType, int size, int timeSample){
	
	mDataType = dataType;
	mDataSize = size;
	mTimeSample = timeSample;
}

void MediaData::initAmfData(int dataType){

	mDataType = dataType;
}

void MediaData::setVideoData(char* data, int width, int height){

	pData = data;
	m_width = width;
	m_height = height;
}

void MediaData::setAudioData(char* data, int samplerate, int channels){

	pData = data;
	m_audiosamplerate = samplerate;
	m_channels = channels;
}
void MediaData::setAmfData(int width, int height, int framerate, int videodatarate, int videocodecid, int channels, int audiodatarate,
	int audiosamplerate, int audiosamplesize, int stereo, int audiocodecid, CString major_brand, CString minor_version,
	CString compatible_brands, CString encoder, int filesize, int duration){

	 m_width = width;
	 m_height = height;
	 m_framerate = framerate;
	 m_videodatarate = videodatarate;
	 m_videocodecid = videocodecid;
	 m_channels = channels;
	 m_audiodatarate = audiodatarate;
	 m_audiosamplerate = audiosamplerate;
	 m_audiosamplesize = audiosamplesize;
	 m_stereo = stereo;
	 m_audiocodecid = audiocodecid;
	 m_major_brand = major_brand;
	 m_minor_version = m_minor_version;
	 m_compatible_brands = compatible_brands;
	 m_encoder = encoder;
	 m_filesize = filesize;
	 m_duration = duration;

}

bool MediaData::isAudioHeader(){

	return mDataType == AUDIODATA;
}

bool MediaData::isVideoHeader(){

	return mDataType == VIDEODATA;
}

bool MediaData::isAmfHeader(){

	return mDataType == AMFDATA;
}

bool MediaData::isAudioData(){

	return mDataType == AUDIODATA;
}

bool MediaData::isVideoData(){

	return mDataType == VIDEODATA;
}

bool MediaData::isAmfData(){

	return mDataType == AMFDATA;
}

char* MediaData::getData(){

	return pData;
}

int MediaData::getDataSize(){

	return mDataSize;
}

int MediaData::getTimeSample(){

	return mTimeSample;
}
